<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
	<base href="/tpshop/">
	<meta charset="utf-8">
	<title>商品详情页</title>
	<link rel="stylesheet" type="text/css" href="/tpshop/Public/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/tpshop/Public/css/bootstrap-theme.min.css">
	 <link rel="stylesheet" type="text/css" href="/tpshop/Public/css/front.css">
</head>
<body>
	<div class="container">
<!--head-->	
	<div class="row">
	<div class="col-md-3">
		<a href="<?php echo U('home/front/index') ?>"><img id="logo" src="/tpshop/Public/img/logo.jpg"></a>
	</div>
	<div class="col-md-6">
		<p id="phone"><i class="glyphicon glyphicon-earphone "></i>400-123456789<i class="glyphicon glyphicon-envelope"></i>shop@googjobs</p>
		<div class="input-group">
	      <input type="text" class="form-control" placeholder="请输入商品名称或店铺名称...">
	      <span class="input-group-btn">
	        <button class="btn btn-danger" type="button">搜索</button>
	      </span>
	    </div>
	</div>
	<div class="col-md-3 ">
		<div id="head_right"><?php if($_SESSION['user_is_login']){ echo '欢迎回来，'.$_SESSION['username']; ?>|<a href="<?php echo U('User/do_logout') ?>">退出</a>
			<?php	 }else{ ?>
			<a href="<?php echo U('User/login') ?>">请登录</a>|<a href="<?php echo U('User/regedit') ?>">欢迎注册</a>
			<?php
 } ?></div>
		<a href="<?php echo U("home/shoping/cart/") ?>" id="sp" class="pull-right"><div id="shopcart">
		
		 <i class="glyphicon glyphicon-shopping-cart"></i>我的购物车<span><?php echo M('user_cart')->where(array('user_id'=>$_SESSION['user_id']))->count() ;?></span></a>
		</div>
	</div>
</div>
<!--banner-->
		<div class="row">
			<div class="col-md-6">
				<div id="prodect_img">
					<img src="/tpshop<?php echo $prodect['img'] ?>" id="main_img">
					<ul>
						<?php foreach ($prodect_img as $pi) { ?>
						<li><img src="/tpshop<?php echo $pi['url'] ?>" class="img" ></li>
						<?php	 } ?>
					</ul>
				</div>
			</div>
			<div class="col-md-6">
				<div id="right">
					<h4><?php echo $prodect['title'] ?></h4>
					<form action="<?php echo U('shoping/add') ?>" method="post">
						<table id="prodect_arg">
							<tr>
								<td class="la">价格:</td>
								<td class="price">￥<?php echo number_format($prodect['price'],2)?></td>
							</tr>
							<tr>
								<td class="la">商品评分:</td>
								<td class="star"><?php for ($i=0; $i < 5; $i++) { ?>
									<?php if($i<$prodect['star']){?><i class="glyphicon glyphicon-star"></i> <?php } else{ ?><i class="glyphicon glyphicon-star-empty"></i>
									<?php
 } } ?>
								</td>
							</tr>
							<tr>
								<td class="la">运费:</td>
								<td class="deliver_fee">满99免运费</td>
							</tr>
							<tr>	
								<input type="hidden" name="prodect_id" value="<?php echo $prodect['id'] ?>">
								<td class="la">购买数量:</td>
								<td class="num"><span id="minus">-</span><input type="text" name="num" value="1" id="n"><span id="add">+</span></td>
							</tr>
							<tr>
								<td class="la">运货:</td>
								<td class="deliver">由仓库全国最近点 发货，并提供售后服务。如有问题咨询在线客服~!
		                         上午08:30前完成下单下午送达,下午下单隔日第二天送达.</td>
							</tr>	
						</table>
						<a href="<?php echo U('home/shoping/cart/') ?>" class="btn btn-danger btn-lg buy">立即购买</a><button type="submit" class="btn btn-info btn-lg car">加入购物车</button>	
					</form>	
			 	</div>
			</div>	
		</div>
		<div class="row">
			<div class="col-md-3"></div>
			<div class="col-md-9">
			<h4>商品详情</h4>
				<?php echo htmlspecialchars_decode($prodect['content']) ?>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript" src="/tpshop/Public/js/jquery.min.js"></script>
<script type="text/javascript" src="/tpshop/Public/js/jquery.elevateZoom-3.0.8.min.js"></script>
	<script type="text/javascript">
	    $(window).load(function() {
	    	$('#prodect_img ul li').mouseover(function(){
	    		$('#prodect_img ul li').removeClass('hover');
	    		$(this).addClass('hover');
	    		var src=$(this).find('img').attr('src');
	    		$('#prodect_img #main_img').attr('src',src);
	    		$('.zoomWindowContainer div').css('background-image','url("'+src+'")');
	    	});
	    	$( '.num #add').click(function(){
	    		var n=$('.num #n').val();
	    		n=parseInt(n)+1;
	    		$('.num #n').val(n);
	    	});
	    	$('.num #minus').click(function(){
	    		var n=$('.num #n').val();
	    		 n=parseInt(n)-1;
	    		if(n>0){
	    			$('.num #n').val(n);
	    		};
	    	})
	    	$(' #prodect_img #main_img').elevateZoom({
	    		//zoomType:"inner",
	    		zoomWindowWidth:300,
	    		zoomWindowHeight:300,

	    	});  
	    });
	</script>